package com.zk.algorithm.greedy;

import com.zk.algorithm.annotation.Finished;

import java.util.Arrays;

/**
 * 挑战程序设计竞赛 - POJ NO.2456
 *
 * N: N 间牛舍
 * i 号牛位于 Xi 位置
 * M: 头牛不太满意，总是互相攻击
 *
 * M 头牛尽可能远
 *
 * @author zk
 */
@Finished(false)
public class AggressiveCows {

    public void solve(int[] x, int n, int m) {
        // 对牛舍位置进行排序
        Arrays.sort(x);
    }

    private boolean isOk(int[] x, int N, int M, int d) {
        int last = 0;

        for (int i = 1; i < M; i++) {
            int crt = last + 1;
            while (crt < N && x[crt] - x[last] < d) {
                crt++;
            }

            if (crt == N) {
                return false;
            }

            last = crt;
        }

        return true;
    }

}
